{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [],
   "source": [
    "from sqlalchemy import create_engine\n",
    "import pandas as pd\n",
    "engine = create_engine('mysql+pymysql://rocky:@raspberrypi:3306/db_daily?charset=utf8')\n",
    "df = pd.read_sql('2018-03-08',engine,index_col='index')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>code</th>\n",
       "      <th>name</th>\n",
       "      <th>changepercent</th>\n",
       "      <th>trade</th>\n",
       "      <th>open</th>\n",
       "      <th>high</th>\n",
       "      <th>low</th>\n",
       "      <th>settlement</th>\n",
       "      <th>volume</th>\n",
       "      <th>turnoverratio</th>\n",
       "      <th>amount</th>\n",
       "      <th>per</th>\n",
       "      <th>pb</th>\n",
       "      <th>mktcap</th>\n",
       "      <th>nmc</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>index</th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>603999</td>\n",
       "      <td>读者传媒</td>\n",
       "      <td>0.558</td>\n",
       "      <td>7.21</td>\n",
       "      <td>7.13</td>\n",
       "      <td>7.23</td>\n",
       "      <td>7.13</td>\n",
       "      <td>7.17</td>\n",
       "      <td>1363578</td>\n",
       "      <td>0.59183</td>\n",
       "      <td>9793108</td>\n",
       "      <td>24.862</td>\n",
       "      <td>2.490</td>\n",
       "      <td>4.152960e+05</td>\n",
       "      <td>1.661184e+05</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>603998</td>\n",
       "      <td>方盛制药</td>\n",
       "      <td>0.000</td>\n",
       "      <td>9.43</td>\n",
       "      <td>0.00</td>\n",
       "      <td>0.00</td>\n",
       "      <td>0.00</td>\n",
       "      <td>9.43</td>\n",
       "      <td>0</td>\n",
       "      <td>0.00000</td>\n",
       "      <td>0</td>\n",
       "      <td>58.938</td>\n",
       "      <td>4.066</td>\n",
       "      <td>4.063731e+05</td>\n",
       "      <td>4.009605e+05</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>603997</td>\n",
       "      <td>继峰股份</td>\n",
       "      <td>2.321</td>\n",
       "      <td>11.46</td>\n",
       "      <td>11.08</td>\n",
       "      <td>11.48</td>\n",
       "      <td>11.05</td>\n",
       "      <td>11.20</td>\n",
       "      <td>4809305</td>\n",
       "      <td>0.76338</td>\n",
       "      <td>54562282</td>\n",
       "      <td>19.424</td>\n",
       "      <td>4.378</td>\n",
       "      <td>7.308262e+05</td>\n",
       "      <td>7.219800e+05</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>603996</td>\n",
       "      <td>中新科技</td>\n",
       "      <td>0.479</td>\n",
       "      <td>16.78</td>\n",
       "      <td>16.74</td>\n",
       "      <td>16.90</td>\n",
       "      <td>16.64</td>\n",
       "      <td>16.70</td>\n",
       "      <td>898350</td>\n",
       "      <td>0.86986</td>\n",
       "      <td>15063977</td>\n",
       "      <td>43.026</td>\n",
       "      <td>3.546</td>\n",
       "      <td>5.036517e+05</td>\n",
       "      <td>1.732955e+05</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>603993</td>\n",
       "      <td>洛阳钼业</td>\n",
       "      <td>-4.124</td>\n",
       "      <td>8.37</td>\n",
       "      <td>8.52</td>\n",
       "      <td>8.66</td>\n",
       "      <td>8.27</td>\n",
       "      <td>8.73</td>\n",
       "      <td>313648156</td>\n",
       "      <td>2.42130</td>\n",
       "      <td>2637520003</td>\n",
       "      <td>139.500</td>\n",
       "      <td>4.850</td>\n",
       "      <td>1.807856e+07</td>\n",
       "      <td>1.084227e+07</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "         code  name  changepercent  trade   open   high    low  settlement  \\\n",
       "index                                                                        \n",
       "0      603999  读者传媒          0.558   7.21   7.13   7.23   7.13        7.17   \n",
       "1      603998  方盛制药          0.000   9.43   0.00   0.00   0.00        9.43   \n",
       "2      603997  继峰股份          2.321  11.46  11.08  11.48  11.05       11.20   \n",
       "3      603996  中新科技          0.479  16.78  16.74  16.90  16.64       16.70   \n",
       "4      603993  洛阳钼业         -4.124   8.37   8.52   8.66   8.27        8.73   \n",
       "\n",
       "          volume  turnoverratio      amount      per     pb        mktcap  \\\n",
       "index                                                                       \n",
       "0        1363578        0.59183     9793108   24.862  2.490  4.152960e+05   \n",
       "1              0        0.00000           0   58.938  4.066  4.063731e+05   \n",
       "2        4809305        0.76338    54562282   19.424  4.378  7.308262e+05   \n",
       "3         898350        0.86986    15063977   43.026  3.546  5.036517e+05   \n",
       "4      313648156        2.42130  2637520003  139.500  4.850  1.807856e+07   \n",
       "\n",
       "                nmc  \n",
       "index                \n",
       "0      1.661184e+05  \n",
       "1      4.009605e+05  \n",
       "2      7.219800e+05  \n",
       "3      1.732955e+05  \n",
       "4      1.084227e+07  "
      ]
     },
     "execution_count": 6,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 2",
   "language": "python",
   "name": "python2"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 2
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython2",
   "version": "2.7.3"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
